//
//  MarkCell.swift
//  Aiwei
//
//  Created by zhu xietong on 2017/11/9.
//  Copyright © 2017年 zhu xietong. All rights reserved.
//

import Foundation
import Eelay
import soapp

class MarkCell<Line:LineHeight>: FieldCell {
    
    var textV = TextAreaField()
    override func addLayoutRules() {
//        let w = Int(FieldCell.name_width)
        let t = Int(FieldCell.padding_top)
        let b = Int(FieldCell.padding_bottom)
        let l = Int(FieldCell.padding_left)
        
        contentView.eelay = [
            [titleL,[ee.T.L,[t,l]],"21",60],
            [requiredMark,[titleL,ee.Y,3],[titleL,ee.R,ee.L,10]],
            [__line,[ee.L.B.R,[0,0.0]],"0.5"],
            [textV,[requiredMark,ee.R,ee.L,2],[ee.R,-AppTheme.edge],[titleL,ee.T,-7],"\(Line.height)",[ee.B,-b]],
        ]
        self.indicator = .none
        
        titleL.setContentConstrainToHighLever()
        requiredMark.ui.font18.text("*").text(color: .clear)
        rightIcon.ui.font(size: 13).ncolor(hex: "#aaa")
        _ = titleL.ui.font15.cl_222
    }
    
    override func mo_model_reload() {
        self.titleL.text = mo.model["title",""]
//        contentView.fillData(model: mo.model)
        
        if let f = DataNode<NSMutableDictionary>.path(node: "\(FK.field)", mo.model)
        {
            textV.mo.model = f
        }
        else
        {
            if let f = DataNode<NSMutableDictionary>.path(node: "\(FK.fields).0", mo.model)
            {
                textV.mo.model = f
            }
        }
//        textV.valueT.bsui.background(color: _table_bk_color)
    }
    
}


